import React, { Component } from 'react'
import './index.css'
// import PubSub from 'pubsub-js'
import News from './News'
import Message from './Message'
import MyNavLink from '../../components/MyNavLink'
import { Redirect, Route, Switch } from 'react-router-dom'

export default class Home extends Component {
    render() {
        // console.log(this.props);
        return (
            <div>
                <p>
                    <MyNavLink to="/home/news">News</MyNavLink>
                    <MyNavLink to="/home/message">Message</MyNavLink>
                </p>

                <Switch>
                    <Route path="/home/news" component={News} />
                    <Route path="/home/message" component={Message} />
                    <Redirect to='/home/news' />
                </Switch>
            </div>
        )
    }
}